﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

namespace Device
{
    public partial class 练习 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button3_Click(object sender, EventArgs e)
        {
            using (Model1Container db = new Model1Container())
            {
                Equiment sh = new Equiment();
                sh.serialnumber = TextBox12.Text.Trim();
                
                db.Equiment集.AddObject(sh);
                db.SaveChanges();
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            using (Model1Container db = new Model1Container())
            {
                    Audience sh = new Audience();
                    sh.username = TextBox6.Text.Trim();
                    sh.password =  System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(TextBox2.Text.Trim(), "SHA1");
                    sh.email =TextBox8 .Text .Trim ();
                    sh.loginpower =TextBox11 .Text .Trim ();
                    sh.question =TextBox9 .Text .Trim ();
                    sh.answer =TextBox10 .Text .Trim ();
                    db.Audience集.AddObject(sh);
                    db.SaveChanges();
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            using (Model1Container db = new Model1Container())
            {
                EquipmentMaster sh = new EquipmentMaster();
                sh.username = TextBox1.Text.Trim();
                sh.password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(TextBox2.Text.Trim(), "SHA1");
                sh.email = TextBox3.Text.Trim();
                sh.question = TextBox4.Text.Trim();
                sh.answer = TextBox5.Text.Trim();
                sh.name = TextBox14.Text.Trim();
                db.EquipmentMaster集.AddObject(sh);
                db.SaveChanges();
            }
        }
    }
}